package com.liwy3.lark.msgbot;

import com.liwy3.YQMap;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

@Accessors(chain = true)
@Data
public class LarkBotMsgDiv {

    private String tag = "div";
    private List<Object> fields = new ArrayList<>();

    public LarkBotMsgDiv addPlainText(boolean isShort, String content) {
        fields.add(new YQMap()
                .append("is_short", isShort)
                .append("text", new LarkBotMsgText().setTag(LarkBotMsgText.TagPlanText).setContent(content)));
        return this;
    }

    public LarkBotMsgDiv addLarkMd(boolean isShort, String content) {
        fields.add(new YQMap()
                .append("is_short", isShort)
                .append("text", new LarkBotMsgText().setTag(LarkBotMsgText.TagLarkMd).setContent(content)));
        return this;
    }
}
